Fedora 22
Sponsored Link

Docker : Add Container Images
2015/06/03
 
Add Container Images.
[1] For exmaple, update official image with installing httpd and add it as a new image for containers. The container is generated every time for executing "docker run" command, so add the latest executed container like follows.
# show the list of images

[root@dlp ~]#
docker images

REPOSITORY          TAG      IMAGE ID      CREATED     VIRTUAL SIZE
docker.io/fedora    latest   ded7cd95e059  7 days ago  186.5 MB

# start a Container and install httpd

[root@dlp ~]#
docker run fedora /bin/bash -c "dnf -y update; dnf -y install httpd"

[root@dlp ~]#
docker ps -a | head -2

CONTAINER ID  IMAGE         COMMAND               CREATED        STATUS                   PORTS  NAMES
d112fe965f30  fedora:latest "/bin/bash -c 'dnf -  3 minutes ago  Exited (0) 6 seconds ago        stupefied_archimedes

# add the image with httpd

[root@dlp ~]#
docker commit d112fe965f30 images/fedora_httpd

f03eb9d0642c0291c5cf8e2022239a8116d6142466331f5cfab7fd046810e184
# show the list

[root@dlp ~]#
docker images

REPOSITORY            TAG     IMAGE ID      CREATED          VIRTUAL SIZE
images/fedora_httpd   latest  f03eb9d0642c  17 seconds ago   386.3 MB
docker.io/fedora      latest  ded7cd95e059  7 days ago       186.5 MB

# Generate a Container from the new image and make sure httpd exists

[root@dlp ~]#
docker run images/fedora_httpd /usr/sbin/httpd -V

AH00558: httpd: Could not reliably determine the server's fully qualified domain name, 
using 172.17.0.6. Set the 'ServerName' directive globally to suppress this message
Server version: Apache/2.4.12 (Fedora)
Server built:   Mar 27 2015 09:23:02
Server's Module Magic Number: 20120211:41
Server loaded:  APR 1.5.1, APR-UTIL 1.5.4
Compiled using: APR 1.5.1, APR-UTIL 1.5.4
Architecture:   64-bit
Server MPM:     prefork
  threaded:     no
    forked:     yes (variable process count)
.....
.....
 
Tweet